package demo1;

public class Computer{
    public void powerOn(){
        System.out.println("打开电脑");
    }
    public void powerOff(){
        System.out.println("关闭电脑");
    }

    public void useDevice(IUSB iusb){
        iusb.fun();
        if(iusb instanceof Mouse){
            iusb.openDevice();
            ((Mouse) iusb).click();
        }
        if(iusb instanceof KeyBorad){
            iusb.openDevice();
            ((KeyBorad) iusb).input();
        }
        iusb.offDevice();
    }
}
